/**
 * Created by Administrator on 2016/9/18.
 */

//背景图
$(function(){
    var flag = true;
    var img_current_BgImage;
    function backgroundImage(){
        var img_path = "images/bg/";
        var img_num = 23;

        var img_current_num = function(){
            return Math.floor(Math.random()*img_num+1);
        };

        var img_url = function(){
            return img_path + "bg_" + img_current_num() + ".jpg";
        };

        img_current_BgImage = img_url();

        $("body").css({backgroundImage:"url("+img_current_BgImage+")"});
    }
    backgroundImage();


    //间隔背景
    $("#header-content").on("click",function(){
        backgroundImage();
    });


    //箭头

    var $up = $("#up-arrow");

    $up.on("click",function(){
        var container = $("#container");
        if(flag){
            container.addClass("folded");
            $up.css(
                {backgroundImage:"url(images/bg/down-arrow.jpg)"},
                {cursor:"s-resize"}
                );
        }else {
            container.removeClass("folded");
            $up.css(
                {backgroundImage:"url(images/bg/up-arrow.jpg)"},
                {cursor:"n-resize"}
            );
        }
        flag = !flag;
    });



});